import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect: "/index/home"
  },
  {
    path: '/index',
    name: 'index',
    component: () => import(/* webpackChunkName: "index" */ '../views/Index/index.vue'),
    children: [
      {
        path: '/index/home',
        name: 'Home',
        component: () => import(/* webpackChunkName: "Home" */ '../views/Index/Home/index.vue'),
      },
      {
        path: '/index/classlist',
        name: 'Classlist',
        component: () => import(/* webpackChunkName: "Classlist" */ '../views/Index/Classlist/index.vue'),
      },
      {
        path: '/index/buycar',
        name: 'Buycar',
        component: () => import(/* webpackChunkName: "Buycar" */ '../views/Index/Buycar/index.vue'),
      },
      {
        path: '/index/find',
        name: 'Find',
        component: () => import(/* webpackChunkName: "Find" */ '../views/Index/Find/index.vue'),
      },
      {
        path: '/index/my',
        name: 'My',
        component: () => import(/* webpackChunkName: "My" */ '../views/Index/My/index.vue'),
      }
    ]
  },
  {
    path: '/detail/:id',
    name: 'Detail',
    component: () => import(/* webpackChunkName: "Home" */ '../views/Detail/index.vue'),
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
